/**
 * 
 */
package FileSystemOperations;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @author Propriétaire
 * 
 */
public class FileSystemOperations {
	
	public static boolean writeInFile(String filePath, String text, boolean append) {
		try {
			FileWriter fw = new FileWriter(filePath, append);
			BufferedWriter output = new BufferedWriter(fw);
			output.write(text);
			output.flush();
			output.close();
			return true;
		} catch (IOException ioe) {
			ioe.printStackTrace();
			return false;
		}
		
	}
	
	/**
	 * @param m
	 * @param filePath
	 */
	public static void printIntoCSV(Object o, String filePath) {
		writeInFile(filePath, o + ";", true);
		
	}
	
	public static void FistCallForCSV(String filePath) {
		// Dimension;N;Log2 error
		// String result = ";log2 error\n";
		writeInFile(filePath, "", false);
		
	}
	
	public static void Breakline(String filePath) {
		String result = "\n";
		writeInFile(filePath, result, true);
		
	}
}
